home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form Form1
- Caption = "Internet Macros"
- ClientHeight = 1965
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 5895
- LinkTopic = "Form1"
- ScaleHeight = 1965
- ScaleWidth = 5895
- StartUpPosition = 3 'Windows-Standard
- Begin VB.CommandButton bt_exchange_rate
- Caption = "Get US$ exchange rate"
- Height = 525
- Left = 330
- TabIndex = 5
- Top = 570
- Width = 1245
- End
- Begin VB.CommandButton Command3
- Caption = "Close"
- Height = 285
- Left = 4710
- TabIndex = 4
- Top = 1500
- Width = 765
- End
- Begin VB.CheckBox chkTray
- Caption = "Run macros in system tray"
- Height = 285
- Left = 330
- TabIndex = 2
- Top = 1500
- Width = 3405
- End
- Begin VB.CommandButton Command2
- Caption = "Order Dinner"
- Height = 525
- Left = 4020
- TabIndex = 1
- Top = 570
- Width = 1245
- End
- Begin VB.CommandButton Command1
- Caption = "Order Lunch"
- Height = 525
- Left = 2175
- TabIndex = 0
- Top = 570
- Width = 1245
- End
- Begin VB.Label lbl_message
- BackColor = &H00C0FFFF&
- BorderStyle = 1 'Fest Einfach
- Caption = "IIM Messages"
- Height = 405
- Left = 3510
- TabIndex = 7
- Top = 30
- Width = 2265
- End
- Begin VB.Label Label2
- Caption = "Status:"
- Height = 225
- Left = 2850
- TabIndex = 6
- Top = 120
- Width = 585
- End
- Begin VB.Label Label1
- Caption = "Visual Basic Example Program"
- Height = 225
- Left = 90
- TabIndex = 3
- Top = 90
- Width = 2205
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- 'iOpus Internet Macros
- 'http://www.iopus.com/iim.htm
- '(c) iOpus Software GmbH
- Dim iim1 As Object
- Dim bUseOpenIIM As Boolean
- Private Sub Form_Load()
- 'Create an object based on the Scripting Interface
- 'This way we can copy & paste all the VBS (Windows Scripting) example code
- 'directly into a VB project
- Set iim1 = CreateObject("iimwsh.iim")
- 'Alternative: You can also add "iimwsh.ocx" to your list of VB compoments
- 'and then drag and drop it on your form (just like, for example, a timer object)
- End Sub
- Private Sub bt_exchange_rate_Click()
- Dim sSplit() As String
- Dim data As String
- Dim d0 As String
- Dim d1 As String
- Dim sCmdLine As String
- lbl_message = "Running..."
- 'Initialize and start IIM browser
- If chkTray.Value = 1 Then sCmdLine = "-tray"
- iret = iim1.iimInit(sCmdLine, True)
- 'Tip: With iret = iim1.iimInit(sCmdLine, FALSE) you can ask the Scripting Interface to
- 'connect to an already open IIM browser. If there is no IIM browser open, the return value
- 'will be negative.
- iret = iim1.iimDisplay("Extract Example")
- 'Set a new command line for the next PLAY command
- If chkTray.Value = 1 Then iret = iim1.iimSet("-tray", "")
- 'Normally the Scripting Interface waits about 10 seconds before a Scripting Interface
- 'timeout error occurs (for example, if a user closed the IIM browser while it was running,
- 'please do not confuse this with the BROWSER timeout errors if a web page loads too slow.)
- 'iret = iim1.iimSetInternal("INTERFACETIMEOUT", 1) 'reduce the interface timeout to 1s
- iplay = iim1.iimPlay("wsh-extract")
- data = iim1.iimGetLastMessage()
- iret = iim1.iimExit
- If iplay = 2 Then
- lbl_message = "Done!"
- sSplit = Split(data, "[EXTRACT]")
- d0 = sSplit(0)
- If UBound(sSplit) > 0 Then d1 = sSplit(1)
- S = "One US$ costs " + d0 + " EURO or " + d1 + " British Pounds (GBP)"
- MsgBox S
- lbl_message = "Done!"
- End If
- If iplay = 1 Then
- lbl_message = "Done, but no data extracted"
- End If
- If iplay < 0 Then
- lbl_message = data
- End If
- End Sub
- Private Sub Command1_Click()
- 'Order Lunch
- lbl_message = "Running..."
- If chkTray.Value = 1 Then
- iret = iim1.iimInit("-tray")
- iret = iim1.iimInit
- End If
- iret = iim1.iimDisplay("Start First Part")
- If chkTray.Value = 1 Then iret = iim1.iimSet("-tray", "")
- iret = iim1.iimPlay("wsh-start")
- If iret < 0 Then
- 'MsgBox iim1.iimGetLastMessage()
- lbl_message = iim1.iimGetLastMessage()
- End If
- iret = iim1.iimPlay("wsh-lunch")
- If iret < 0 Then
- 'MsgBox iim1.iimGetLastMessage()
- lbl_message = iim1.iimGetLastMessage()
- End If
- iret = iim1.iimDisplay("Almost done!")
- iret = iim1.iimPlay("wsh-submit")
- 'Typically "iimPlay" is the only command where errors can occur
- If iret < 0 Then
- 'MsgBox iim1.iimGetLastMessage()
- lbl_message = iim1.iimGetLastMessage()
- lbl_message = "Done!"
- End If
- iret = iim1.iimExit
- End Sub
- Private Sub Command2_Click()
- 'Order Dinner
- lbl_message = "Running..."
- If chkTray.Value = 1 Then
- iret = iim1.iimInit("-tray")
- iret = iim1.iimInit
- End If
- iret = iim1.iimDisplay("Start First Part")
- If chkTray.Value = 1 Then iret = iim1.iimSet("-tray", "")
- 'Navigate to the order page
- iret = iim1.iimPlay("wsh-start")
- If iret < 0 Then
- lbl_message = iim1.iimGetLastMessage()
- End If
- iret = iim1.iimPlay("wsh-dinner")
- If iret < 0 Then
- 'MsgBox iim1.iimGetLastMessage()
- lbl_message = iim1.iimGetLastMessage()
- End If
- iret = iim1.iimDisplay("Almost done!")
- 'Submits the order
- iret = iim1.iimPlay("wsh-submit")
- If iret < 0 Then 'Typically "iimPlay" is the only command where errors can occur (for example, a timeout error)
- lbl_message = iim1.iimGetLastMessage()
- lbl_message = "Done!"
- End If
- 'Close IIM
- iret = iim1.iimExit
- End Sub
- Private Sub Command3_Click()
- End Sub
-